Skip to content

This closes #2503, resolve the defined name referenced by the current workbook index - #2508

Open
ruziba3vich wants to merge 1 commit into
qax-os:masterfrom
ruziba3vich:calc-defined-name-self-ref
Open

ruziba3vich wants to merge 1 commit into
qax-os:masterfrom
ruziba3vich:calc-defined-name-self-ref

Conversation

@ruziba3vich

@ruziba3vich ruziba3vich commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

PR Details

Description

CalcCellValue returned #NAME? when resolving a defined name prefixed with [0]!, which Excel uses to reference names in the current workbook. This change updates getDefinedNameRefTo in lib.go to strip the [0]! prefix and resolve the name in workbook scope, with regression tests covering the behavior.

Related Issue

Closes #2503

Motivation and Context

Excel itself writes and reads defined names using the [0]!Name notation, but Excelize currently fails to resolve them and returns #NAME?. Apache POI also treats this notation as a reference to a name in the current workbook, which supports the expected behavior implemented here.

How Has This Been Tested

Added regression cases to TestCalcWithDefinedName covering workbook-scoped name resolution, function arguments, and unknown names, verifying that they fail without the fix and pass with it. Ran go test . locally on macOS; all tests passed.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@ruziba3vich ruziba3vich changed the title This closes #2503, resolve the defined name referenced by the current… This closes #2503, resolve the defined name referenced by the current workbook index Nov 19, 2026
@xuri xuri added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 20, 2026
@ruziba3vich
ruziba3vich force-pushed the calc-defined-name-self-ref branch from e3fa32e to 9c6e0ea Compare November 23, 2026 15:33
@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.72%. Comparing base (ec40786) to head (9c6e0ea).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2508   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          32       32           
  Lines       33202    33236   +34     
=======================================
+ Hits        33112    33146   +34     
  Misses         88       88           
  Partials        2        2           
Flag Coverage Δ
unittests 99.72% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CalcCellValue returns #NAME? for a defined name referenced as [0]!Name

2 participants